package limeirafol.gui.financeiro;

import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import javax.swing.SwingConstants;
import lbframework.bean.internalFrame.LBInternalFrame;
import lbframework.bean.mdiFrame.LBMdiFrame;
import lbframework.bean.table.LBColumnTable;
import lbframework.classe.LBException;
import lbframework.classe.Util;
import lbframework.remote.ItemComboVO;
import limeirafol.Global;
import limeirafol.bean.BeanFinanceiro;
import limeirafol.remote.financeiro.ChequesRecebidosFiltroConsultaVO;
import limeirafol.remote.financeiro.ChequesRecebidosVO;
import limeirafol.remote.financeiro.SituacaoChequeRecebido;

public class ChequesRecebidosConsultaGUI extends LBInternalFrame {

    BeanFinanceiro beanFinanceiro = new BeanFinanceiro();
    public Vector<ChequesRecebidosVO> vChequesRecebidos = new Vector<ChequesRecebidosVO>();

    public ChequesRecebidosConsultaGUI(LBMdiFrame i_mdiFrame) throws Exception {
        super(i_mdiFrame);
        initComponents();
        centralizarForm();
        this.setMaximum(true);

        cboTipoData.addItem(new ItemComboVO(1, "LANÇAMENTO"));
        cboTipoData.addItem(new ItemComboVO(2, "VENCIMENTO"));
        cboTipoData.addItem(new ItemComboVO(-1, "TODOS"));

        cboSituacaoCheque.setTabela("situacaocheque");
        cboSituacaoCheque.carregar();
        cboSituacaoCheque.addItem(new ItemComboVO(-1, "TODOS"));
        cboSituacaoCheque.setId(-1);

        txtDataInicio.setConsultaData(Global.class.getMethod("getDataProcessamento"));
        txtDataTermino.setConsultaData(Global.class.getMethod("getDataProcessamento"));
    }

    @Override
    public void consultar() throws Exception {
        Util.validarCampoTela(this.getCampoObrigatorio());
        ChequesRecebidosFiltroConsultaVO oFiltro = new ChequesRecebidosFiltroConsultaVO();

        oFiltro.tipoData = cboTipoData.getId();
        oFiltro.dataInicio = txtDataInicio.getClipText().isEmpty() ? "" : txtDataInicio.getText();
        oFiltro.dataTermino = txtDataTermino.getClipText().isEmpty() ? "" : txtDataTermino.getText();
        oFiltro.numeroCheque = txtNumeroCheque.getText();
        oFiltro.descricao = txtDescricao.getText();
        oFiltro.idSituacaoCheque = cboSituacaoCheque.getId();

        vChequesRecebidos = beanFinanceiro.consultarChequesRecebidos(oFiltro);

        exibirConsulta();

    }

    @Override
    public void incluir() throws Exception {
        ChequesRecebidosCadastroGUI form = new ChequesRecebidosCadastroGUI(mdiFrame);
        form.incluir();
        form.setVisible(true);
    }

    @Override
    public void editar() throws Exception {
        try {
            carregarChequeRecebido();
        } catch (Exception e) {
            Util.exibirMensagemErro(e, getTitle());
        }
    }

    private void exibirConsulta() throws Exception {
        LBColumnTable[] colunas = new LBColumnTable[]{
            new LBColumnTable("Código", 60, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Data Lançamento", 100, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Nro. Cheque", 100, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Descricao", 200, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Valor", 100, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Cheque Pré", 80, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Data Bom Para", 100, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Situacao Cheque", 100, true, SwingConstants.LEFT, false, null),
            new LBColumnTable("Observações", 200, true, SwingConstants.LEFT, false, null)
        };

        Object[][] dados = new Object[vChequesRecebidos.size()][colunas.length];
        int i = 0;
        for (ChequesRecebidosVO oCheque : vChequesRecebidos) {
            dados[i][0] = Util.formatNumber(oCheque.id, 6);
            dados[i][1] = oCheque.dataLancamento;
            dados[i][2] = Util.formatNumber(oCheque.numeroCheque, 8);
            dados[i][3] = oCheque.descricao;
            dados[i][4] = Util.formatDecimal2(oCheque.valor);
            dados[i][5] = oCheque.bomPara;
            dados[i][6] = oCheque.dataBomPara;
            dados[i][7] = oCheque.situacaoCheque;
            dados[i][8] = oCheque.observacoes;
            i++;
        }

        tblConsulta.setModel(dados, colunas);

        tblConsulta.requestFocus();
    }

    private void carregarChequeRecebido() throws Exception {
        if (tblConsulta.getLinhaSelecionada() == -1) {
            throw new LBException(Util.MSG_NENHUM_ITEM_SELECIONADO);
        }
        ChequesRecebidosVO oChequesRecebidos = vChequesRecebidos.get(tblConsulta.getLinhaSelecionada());

        if (consultaCampo == null) {
            ChequesRecebidosCadastroGUI form = new ChequesRecebidosCadastroGUI(mdiFrame);

            form.carregarChequeRecebido(oChequesRecebidos.id);
            form.setVisible(true);

        } else {
            this.setVisible(false);
            consultaCampo.setParentSelected(true);
            consultaCampo.setId(oChequesRecebidos.id);
            consultaCampo.consultar(true);
            consultaCampo.transferFocus();
        }
    }

    @Override
    public void excluir() throws Exception {
        if (tblConsulta.getLinhaSelecionada() == -1) {
            throw new LBException(Util.MSG_NENHUM_ITEM_SELECIONADO);
        }

        Util.exibirMensagemConfirmar(Util.MSG_CONFIRMA_EXCLUSAO, getTitle());
        ChequesRecebidosVO oChequeRecebido = vChequesRecebidos.get(tblConsulta.getLinhaSelecionada());
        ChequesRecebidosVO oCheque = beanFinanceiro.carregarChequeRecebido(oChequeRecebido.id);

        if (oCheque.idSituacaoCheque != SituacaoChequeRecebido.ABERTO.getId()) {
            throw new LBException("O cheque não pode ser deletado. Estorne o cheque para delata-lo!");
        }

        beanFinanceiro.excluirChequeRecebido(oChequeRecebido.id);
        vChequesRecebidos.remove(oChequeRecebido);



        exibirConsulta();
    }

    @Override
    public void imprimir() throws Exception {
        Map parametro = new HashMap();

        if (!txtDataInicio.getClipText().isEmpty() && !txtDataTermino.getClipText().isEmpty()) {
            parametro.put("FILTRO", txtDataInicio.getText() + " A " + txtDataTermino.getText());
        }

        Global.imprimir("ChequesRecebidos.jasper", vChequesRecebidos, parametro);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lBToolBarPadrao1 = new lbframework.bean.toolBarPadrao.LBToolBarPadrao(this);
        lBPanel1 = new lbframework.bean.panel.LBPanel();
        cboTipoData = new lbframework.bean.comboBox.LBComboBox();
        lBLabel1 = new lbframework.bean.label.LBLabel();
        vRLabel6 = new lbframework.bean.label.LBLabel();
        txtDataInicio = new lbframework.bean.calendar.LBCalendar();
        vRLabel7 = new lbframework.bean.label.LBLabel();
        txtDataTermino = new lbframework.bean.calendar.LBCalendar();
        txtNumeroCheque = new lbframework.bean.textField.LBTextField();
        lBLabel2 = new lbframework.bean.label.LBLabel();
        txtDescricao = new lbframework.bean.textField.LBTextField();
        lBLabel3 = new lbframework.bean.label.LBLabel();
        cboSituacaoCheque = new lbframework.bean.comboBox.LBComboBox();
        lBLabel4 = new lbframework.bean.label.LBLabel();
        tblConsulta = new lbframework.bean.tableEx.LBTableEx();
        lBPanel2 = new lbframework.bean.panel.LBPanel();
        lBButton1 = new lbframework.bean.button.LBButton();
        lBButton2 = new lbframework.bean.button.LBButton();

        lBToolBarPadrao1.setRollover(true);
        lBToolBarPadrao1.setVisibleConsultar(true);
        lBToolBarPadrao1.setVisibleEditar(true);
        lBToolBarPadrao1.setVisibleExcluir(true);
        lBToolBarPadrao1.setVisibleImprimir(true);
        lBToolBarPadrao1.setVisibleIncluir(true);

        lBLabel1.setText("Tipo Data:");

        vRLabel6.setText("Periodo");

        txtDataInicio.setObrigatorio(true);
        txtDataInicio.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusLost(java.awt.event.FocusEvent evt) {
                txtDataInicioFocusLost(evt);
            }
        });

        vRLabel7.setText("a");

        txtDataTermino.setObrigatorio(true);

        txtNumeroCheque.setColumns(15);

        lBLabel2.setText("Nro. do Cheque");

        lBLabel3.setText("Descrição");

        lBLabel4.setText("Situação");

        javax.swing.GroupLayout lBPanel1Layout = new javax.swing.GroupLayout(lBPanel1);
        lBPanel1.setLayout(lBPanel1Layout);
        lBPanel1Layout.setHorizontalGroup(
            lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(lBPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(lBPanel1Layout.createSequentialGroup()
                        .addComponent(cboTipoData, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(lBPanel1Layout.createSequentialGroup()
                                .addComponent(txtDataInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(vRLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtDataTermino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(vRLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtNumeroCheque, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lBLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(lBLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lBLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lBLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(cboSituacaoCheque, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        lBPanel1Layout.setVerticalGroup(
            lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(lBPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtDataTermino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vRLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(lBPanel1Layout.createSequentialGroup()
                        .addComponent(vRLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtDataInicio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(lBPanel1Layout.createSequentialGroup()
                        .addComponent(lBLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(cboTipoData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(lBPanel1Layout.createSequentialGroup()
                            .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(lBLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(lBLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(lBPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(txtDescricao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(cboSituacaoCheque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(lBPanel1Layout.createSequentialGroup()
                            .addComponent(lBLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(txtNumeroCheque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tblConsulta.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblConsultaMouseClicked(evt);
            }
        });
        tblConsulta.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                tblConsultaKeyPressed(evt);
            }
        });

        lBButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lbframework/img/consultar.png"))); // NOI18N
        lBButton1.setText("Consultar");
        lBButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lBButton1ActionPerformed(evt);
            }
        });

        lBButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/lbframework/img/sair.png"))); // NOI18N
        lBButton2.setText("Sair");
        lBButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lBButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout lBPanel2Layout = new javax.swing.GroupLayout(lBPanel2);
        lBPanel2.setLayout(lBPanel2Layout);
        lBPanel2Layout.setHorizontalGroup(
            lBPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, lBPanel2Layout.createSequentialGroup()
                .addContainerGap(617, Short.MAX_VALUE)
                .addComponent(lBButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lBButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        lBPanel2Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {lBButton1, lBButton2});

        lBPanel2Layout.setVerticalGroup(
            lBPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(lBPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lBButton1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lBButton2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(lBPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(tblConsulta, javax.swing.GroupLayout.DEFAULT_SIZE, 843, Short.MAX_VALUE))
                    .addComponent(lBToolBarPadrao1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(lBPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(lBToolBarPadrao1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lBPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tblConsulta, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lBPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtDataInicioFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtDataInicioFocusLost
    }//GEN-LAST:event_txtDataInicioFocusLost

    private void lBButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lBButton1ActionPerformed

        try {
            consultar();
        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }


    }//GEN-LAST:event_lBButton1ActionPerformed

    private void tblConsultaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblConsultaMouseClicked
        try {
            if (evt.getClickCount() == 2) {
                carregarChequeRecebido();
            }

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }

    }//GEN-LAST:event_tblConsultaMouseClicked

    private void tblConsultaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tblConsultaKeyPressed

        try {
            if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
                carregarChequeRecebido();
            }

            if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
                excluir();
            }

        } catch (Exception ex) {
            Util.exibirMensagemErro(ex, getTitle());
        }

    }//GEN-LAST:event_tblConsultaKeyPressed

    private void lBButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lBButton2ActionPerformed

        try {
            sair();
        } catch (Exception e) {
        }

    }//GEN-LAST:event_lBButton2ActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private lbframework.bean.comboBox.LBComboBox cboSituacaoCheque;
    private lbframework.bean.comboBox.LBComboBox cboTipoData;
    private lbframework.bean.button.LBButton lBButton1;
    private lbframework.bean.button.LBButton lBButton2;
    private lbframework.bean.label.LBLabel lBLabel1;
    private lbframework.bean.label.LBLabel lBLabel2;
    private lbframework.bean.label.LBLabel lBLabel3;
    private lbframework.bean.label.LBLabel lBLabel4;
    private lbframework.bean.panel.LBPanel lBPanel1;
    private lbframework.bean.panel.LBPanel lBPanel2;
    private lbframework.bean.toolBarPadrao.LBToolBarPadrao lBToolBarPadrao1;
    private lbframework.bean.tableEx.LBTableEx tblConsulta;
    private lbframework.bean.calendar.LBCalendar txtDataInicio;
    private lbframework.bean.calendar.LBCalendar txtDataTermino;
    private lbframework.bean.textField.LBTextField txtDescricao;
    private lbframework.bean.textField.LBTextField txtNumeroCheque;
    private lbframework.bean.label.LBLabel vRLabel6;
    private lbframework.bean.label.LBLabel vRLabel7;
    // End of variables declaration//GEN-END:variables
}
